import os
import fileinput

# 指定目录路径
directory = 'path/to/txts'

# 遍历目录下的文件
for filename in os.listdir(directory):
    if filename.endswith('.txt'):
        filepath = os.path.join(directory, filename)
        
        # 遍历文件的每一行
        for line in fileinput.input(filepath, inplace=True):
            
            '''第一步'''
            # if line.startswith('0 '):
            #     line = '20 ' + line[2:]
            # elif line.startswith('1 '):
            #     line = '21 ' + line[2:]
            # elif line.startswith('2 '):
            #     line = '22 ' + line[2:]
            # elif line.startswith('3 '):
            #     line = '23 ' + line[2:]
            # elif line.startswith('4 '):
            #     line = '24 ' + line[2:]
            # elif line.startswith('5 '):
            #     line = '25 ' + line[2:]
            # elif line.startswith('6 '):
            #     line = '26 ' + line[2:]
            # elif line.startswith('7 '):
            #     line = '27 ' + line[2:]
            # elif line.startswith('8 '):
            #     line = '28 ' + line[2:]
            # elif line.startswith('9 '):
            #     line = '29 ' + line[2:]
            # elif line.startswith('10 '):
            #     line = '30 ' + line[3:]
            # elif line.startswith('11 '):
            #     line = '31 ' + line[3:]
            # elif line.startswith('12 '):
            #     line = '32 ' + line[3:]
            # elif line.startswith('13 '):
            #     line = '33 ' + line[3:]
            # else:
            #     line = '34 ' + line[3:]

            '''第二步'''
            if line.startswith('20 '):
                line = '0 ' + line[3:]
            elif line.startswith('21 '):
                line = '0 ' + line[3:]
            elif line.startswith('22 '):
                line = '0 ' + line[3:]
            elif line.startswith('23 '):
                line = '1 ' + line[3:]
            elif line.startswith('24 '):
                line = '2 ' + line[3:]
            elif line.startswith('25 '):
                continue
            elif line.startswith('26 '):
                line = '3 ' + line[3:]
            elif line.startswith('27 '):
                continue
            elif line.startswith('28 '):
                continue
            elif line.startswith('29 '):
                line = '4 ' + line[3:]
            elif line.startswith('30 '):
                continue
            elif line.startswith('31 '):
                continue
            elif line.startswith('32 '):
                line = '5 ' + line[3:]
            elif line.startswith('33 '):
                continue
            else:
                continue
            
            print(line, end='')
            
        fileinput.close()